package com.mybatisplus.mp.mybatis;

import org.apache.ibatis.session.SqlSessionFactory;
import org.junit.jupiter.api.Test;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;

public class SessionDemo {
    @Autowired
  private   SqlSessionTemplate sqlSessionTemplate;

    @Test
    public void test() throws NoSuchFieldException, IllegalAccessException {
//        SqlSession sqlSession = sqlSessionTemplate.getSqlSessionFactory().openSession(ExecutorType.SIMPLE, false);
       /* User user = sqlSessionTemplate.selectOne("com.mybatisplus.mp.mapper.UserMapper.findById", 1);
        System.out.println(user);*/
        /*Field executorField = sqlSession.getClass().getDeclaredField("executor");
        executorField.setAccessible(true);
        Executor executor = (Executor) executorField.get(sqlSession);*/
        SqlSessionFactory sqlSessionFactory = sqlSessionTemplate.getSqlSessionFactory();
        System.out.println(sqlSessionFactory);
    }
}
